﻿using Microsoft.VisualStudio.TextManager.Interop;

namespace Microsoft.WowAddonStudio.Lua.LanguageService.Support
{
    /// <summary>
    /// Various extension methods used by parts of the language service.
    /// </summary>
    public static class Extensions
    {
        /// <summary>
        /// Determines whether a textspan is 'dirty' and a new parsing should occur.
        /// </summary>
        /// <param name="textSpan">The text span to test.</param>
        /// <returns>True, if the textspan is dirty; False otherwise.</returns>
        public static bool IsDirty(this TextSpan textSpan)
        {
            return (textSpan.iStartIndex != textSpan.iEndIndex || textSpan.iStartLine != textSpan.iEndLine);
        }
    }
}